<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />

    

    
    <title>SpringCloud&amp;Alibaba | welcome</title>
    
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="keywords" content="" />
    
    <meta name="description" content="SpringCloud Alibaba1.springcloud ​    spring团队开源微服务工具集帮助我们快速构建分布式系统（微服务系统） 2.springcloud alibaba ​    阿里巴巴团队开源微服务工具集解决方案 3.springcloud alibaba ​    官方定义：Spring Cloud Alibaba provides a one-stop solut">
<meta property="og:type" content="article">
<meta property="og:title" content="SpringCloud&amp;Alibaba">
<meta property="og:url" content="https://hchdream.gitee.io/hexo/2021/07/03/SpringCloud-Alibaba/index.html">
<meta property="og:site_name" content="welcome">
<meta property="og:description" content="SpringCloud Alibaba1.springcloud ​    spring团队开源微服务工具集帮助我们快速构建分布式系统（微服务系统） 2.springcloud alibaba ​    阿里巴巴团队开源微服务工具集解决方案 3.springcloud alibaba ​    官方定义：Spring Cloud Alibaba provides a one-stop solut">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://w.wallhaven.cc/full/j3/wallhaven-j3wqwm.jpg">
<meta property="article:published_time" content="2021-07-03T08:26:10.000Z">
<meta property="article:modified_time" content="2021-07-03T08:39:28.174Z">
<meta property="article:author" content="XiaoHuang">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://w.wallhaven.cc/full/j3/wallhaven-j3wqwm.jpg">
    

    
        <link rel="alternate" href="/atom.xml" title="welcome" type="application/atom+xml" />
    

    
        <link rel="icon" href="/hexo/css/images/favicon.ico" />
    

    
<link rel="stylesheet" href="/hexo/libs/font-awesome/css/font-awesome.min.css">

    
<link rel="stylesheet" href="/hexo/libs/titillium-web/styles.css">

    
<link rel="stylesheet" href="/hexo/libs/source-code-pro/styles.css">


    
<link rel="stylesheet" href="/hexo/css/style.css">


    
<script src="/hexo/libs/jquery/3.5.0/jquery.min.js"></script>

    
    
        
<link rel="stylesheet" href="/hexo/libs/lightgallery/css/lightgallery.min.css">

    
    
        
<link rel="stylesheet" href="/hexo/libs/justified-gallery/justifiedGallery.min.css">

    
    
    
    


<meta name="generator" content="Hexo 5.2.0"></head>

<body>
    <div id="wrap">
        <header id="header">
    <div id="header-outer" class="outer">
        <div class="container">
            <div class="container-inner">
                <div id="header-title">
                    <h1 class="logo-wrap">
                        <a href="/hexo/" class="logo"></a>
                    </h1>
                    
                </div>
                <div id="header-inner" class="nav-container">
                    <a id="main-nav-toggle" class="nav-icon fa fa-bars"></a>
                    <div class="nav-container-inner">
                        <ul id="main-nav">
                            
                                <li class="main-nav-list-item" >
                                    <a class="main-nav-list-link" href="/hexo/">主页</a>
                                </li>
                            
                                    <ul class="main-nav-list"><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/Java/">Java</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/Spring/">Spring</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/nginx/">nginx</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/springcloud/">springcloud</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">数据库</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/%E9%95%9C%E5%83%8F%E5%8A%A0%E9%80%9F/">镜像加速</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/hexo/categories/%E9%A1%B9%E7%9B%AE/">项目</a></li></ul>
                                
                                <li class="main-nav-list-item" >
                                    <a class="main-nav-list-link" href="/hexo/about/index.html">关于</a>
                                </li>
                            
                        </ul>
                        <nav id="sub-nav">
                            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="想要查找什么..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/hexo/',
        CONTENT_URL: '/hexo/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/hexo/js/insight.js"></script>


</div>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>

        <div class="container">
            <div class="main-body container-inner">
                <div class="main-body-inner">
                    <section id="main">
                        <div class="main-body-header">
    <h1 class="header">
    
    <a class="page-title-link" href="/hexo/categories/springcloud/">springcloud</a>
    </h1>
</div>

                        <div class="main-body-content">
                            <article id="post-SpringCloud-Alibaba" class="article article-single article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
        SpringCloud&amp;Alibaba
        </h1>
    

            </header>
        
        
            <div class="article-meta">
                
  <div class="article-date">
    <i class="fa fa-calendar"></i>
    <a href="/hexo/2021/07/03/SpringCloud-Alibaba/" class="article-date">
       <time datetime="2021-07-03T08:26:10.000Z" itemprop="datePublished">2021-07-03</time>
    </a>
  </div>


<div class="article-date">
  <i class="fa fa-calendar-plus-o"></i>
  <a href="/hexo/2021/07/03/SpringCloud-Alibaba/" class="article-date">
     <time datetime="2021-07-03T08:39:28.174Z" itemprop="dateModified">2021-07-03</time>
  </a>
</div>


                

                
                

                

            </div>
        
        
        <div class="article-entry" itemprop="articleBody">
            

            

            

            <p><img src="https://w.wallhaven.cc/full/j3/wallhaven-j3wqwm.jpg"></p>
<h1 id="SpringCloud-Alibaba"><a href="#SpringCloud-Alibaba" class="headerlink" title="SpringCloud Alibaba"></a>SpringCloud Alibaba</h1><p>1.springcloud</p>
<p>​    spring团队开源微服务工具集帮助我们快速构建分布式系统（微服务系统）</p>
<p>2.springcloud alibaba</p>
<p>​    阿里巴巴团队开源微服务工具集解决方案</p>
<p>3.springcloud alibaba</p>
<p>​    官方定义：Spring Cloud Alibaba provides a <strong>one-stop solution</strong> for <strong>distributed application development</strong>. It contains all the components required to develop distributed applications, making it easy for you to develop your applications using Spring Cloud.</p>
<p>With Spring Cloud Alibaba, you only need to add some annotations and a small amount of configurations to connect Spring Cloud applications to the distributed solutions of Alibaba, and build a distributed application system with Alibaba middleware.</p>
<p>​    翻译：</p>
<p>​    Spring Cloud Alibaba 为分布式应用开发提供一站式解决方案。 它包含开发分布式应用程序所需的所有组件，使您可以轻松地使用 Spring Cloud 开发应用程序。</p>
<p>使用Spring Cloud Alibaba，您只需添加一些注解和少量配置，即可将Spring Cloud应用连接到阿里巴巴的分布式解决方案，并通过阿里巴巴中间件构建分布式应用系统。</p>
<p>​    最新版本： 2.2.1.RELEASE</p>
<p>4.springcloud alibaba 提供了哪些组件 特性</p>
<p>​    a.<strong>Flow control and service degradation</strong> 流量控制和服务降级    <a target="_blank" rel="noopener" href="https://github.com/alibaba/Sentinel/">Sentinel</a> 替换Hystrix</p>
<p>​    b.<strong>Service registration and discovery</strong> 服务注册与发现    <a target="_blank" rel="noopener" href="https://github.com/alibaba/nacos/">Nacos</a>  替换 eureka、consul</p>
<p>​    c.<strong>Distributed Configuration</strong>    统一配置中心    Nacos 替换config    自动配置刷新</p>
<p>​    d.<strong>Event-driven</strong> 事件驱动 利用MQ    RocketMQ    阿里基于Java自研的组件    替换bus</p>
<p>​    e.<strong>Message Bus</strong> 消息总线（异步处理）    RocketMQ</p>
<p>​    f.<strong>Distributed Transaction</strong> 分布式事务    <a target="_blank" rel="noopener" href="https://github.com/seata/seata">Seata</a></p>
<p>​    g.<strong>Dubbo RPC</strong>    集成Dubbo实现服务间通信        Dubbo RPC -&gt; 替换RestTemplate Openfeign</p>
<p>5.微服务实战开发 springcloud Netflix + springcloud Spring + springcloud alibaba</p>
<p>​    1.服务注册中心    nacos</p>
<p>​    2.服务间通信，服务间负载均衡    http  ①RestTemplate -&gt; ribbon ②openfeign</p>
<p>​    3.服务流控和服务降级    sentinel</p>
<p>​    4.服务网关 Gateway</p>
<p>​    5.统一配置中心 nacos</p>
<h1 id="SpringCloud-Alibaba-2-2-1"><a href="#SpringCloud-Alibaba-2-2-1" class="headerlink" title="SpringCloud Alibaba 2.2.1"></a>SpringCloud Alibaba 2.2.1</h1><p>1.创建全局父项目</p>
<p>​    维护springcloud依赖    Hoxton.SR6</p>
<p>​    维护阿里巴巴依赖    2.2.1.RELEASE</p>
<p>​    集成springcloud父项目    2.2.5.RELEASE</p>
<p>2.父项目的依赖维护</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">xmlns</span>=<span class="string">&quot;http://maven.apache.org/POM/4.0.0&quot;</span></span></span><br><span class="line"><span class="tag">         <span class="attr">xmlns:xsi</span>=<span class="string">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span></span><br><span class="line"><span class="tag">         <span class="attr">xsi:schemaLocation</span>=<span class="string">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">modelVersion</span>&gt;</span>4.0.0<span class="tag">&lt;/<span class="name">modelVersion</span>&gt;</span></span><br><span class="line"></span><br><span class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.hch<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>springcloud-alibaba<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.0-RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">&lt;!--集成springboot父项目--&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">parent</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-parent<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">version</span>&gt;</span>2.2.5.RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">parent</span>&gt;</span></span><br><span class="line"></span><br><span class="line">    <span class="tag">&lt;<span class="name">properties</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">java.version</span>&gt;</span>1.8<span class="tag">&lt;/<span class="name">java.version</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">spring.cloud.version</span>&gt;</span>Hoxton.SR6<span class="tag">&lt;/<span class="name">spring.cloud.version</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">spring.cloud.alibaba.version</span>&gt;</span>2.2.1.RELEASE<span class="tag">&lt;/<span class="name">spring.cloud.alibaba.version</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">properties</span>&gt;</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">&lt;!--维护依赖--&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">dependencyManagement</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">dependencies</span>&gt;</span></span><br><span class="line">            <span class="comment">&lt;!--spring cloud--&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-dependencies<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">version</span>&gt;</span>$&#123;spring.cloud.version&#125;<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">type</span>&gt;</span>pom<span class="tag">&lt;/<span class="name">type</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">scope</span>&gt;</span>import<span class="tag">&lt;/<span class="name">scope</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br><span class="line">            <span class="comment">&lt;!--spring cloud alibaba--&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-alibaba-dependencies<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">version</span>&gt;</span>$&#123;spring.cloud.alibaba.version&#125;<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">type</span>&gt;</span>pom<span class="tag">&lt;/<span class="name">type</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">scope</span>&gt;</span>import<span class="tag">&lt;/<span class="name">scope</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependencies</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">dependencyManagement</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">project</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h1 id="Nacos"><a href="#Nacos" class="headerlink" title="Nacos"></a>Nacos</h1><p>name configuration and service</p>
<p>服务注册中心和统一配置中心</p>
<h2 id="Nacos作为服务注册中心使用"><a href="#Nacos作为服务注册中心使用" class="headerlink" title="Nacos作为服务注册中心使用"></a>Nacos作为服务注册中心使用</h2><p>2.使用nacos组件 -&gt; nacos软件    服务注册中心</p>
<p>​    nacos官网：<a target="_blank" rel="noopener" href="https://nacos.io/zh-cn/index.html">https://nacos.io/zh-cn/index.html</a></p>
<p>​    github仓库：<a target="_blank" rel="noopener" href="https://github.com/alibaba/nacos">https://github.com/alibaba/nacos</a></p>
<p>​    使用版本： 1.4.1</p>
<p>​    上传nacos安装包到linux系统</p>
<p>​    安装jdk 1.8以上版本，nacos基于java开发</p>
<p>​    uabntu安装jdk1.8    <a target="_blank" rel="noopener" href="https://blog.csdn.net/chenruicsdn/article/details/53583950">https://blog.csdn.net/chenruicsdn/article/details/53583950</a></p>
<p>​    解压nacos</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf nacos-server-1.4.1.tar.gz</span><br></pre></td></tr></table></figure>

<p>​    查看nacos目录结构</p>
<p>drwxr-xr-x 2 root root   4096 6月  18 17:56 bin/    启动关闭nacos脚本目录<br>drwxr-xr-x 2  502 staff  4096 1月  15 09:43 conf/    配置nacos配置文件目录<br>drwxr-xr-x 2 root root   4096 6月  18 17:56 target/ nacos-server核心目录</p>
<p>3.启动nacos服务，默认nacos启动以集群模式启动，必须满足多个节点</p>
<p>​    单机启动：在bin目录中， ./startup.sh -m standalone</p>
<p>​    查看日志：tail -f nacos.log</p>
<p>​    访问nacos的web地址：<a target="_blank" rel="noopener" href="http://122.207.128.130:8848/nacos/#/login">http://122.207.128.130:8848/nacos/#/login</a></p>
<p>​    用户名/密码 nacos/nacos</p>
<p>4.nacos client 开发</p>
<p>​    创建独立的springboot应用</p>
<p>​    引入nacos client依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--nacos client依赖--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>​    配置nacos服务注册中心的地址</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 配置nacos server配置中心地址 总入口地址</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.server-addr</span>=<span class="string">122.207.128.130:8848</span></span><br></pre></td></tr></table></figure>

<p>​    //@EnableDiscoveryClient 启动类注解可以不加</p>
<p>5.nacos 服务间通信</p>
<p>​    服务间通信：http rest /RPC</p>
<p>​    使用rest方式实现服务间通信</p>
<p>​    1.RestTemplate</p>
<p>​    2.RestTemplate + Ribbon</p>
<p>​    3.OpenFeign    推荐使用</p>
<h2 id="Nacos作为统一配置中心使用"><a href="#Nacos作为统一配置中心使用" class="headerlink" title="Nacos作为统一配置中心使用"></a>Nacos作为统一配置中心使用</h2><p>1.启动nacos服务</p>
<p>​    管理配置文件是在自身的服务器上形成一个版本库，因此不需要再创建远程git仓库</p>
<p>​    nacos作为统一配置中心管理配置文件时，同样也是具有版本控制的功能</p>
<p>2.开发微服务作为统一配置中心客户端将配置交给nacos进行管理</p>
<pre><code> 开发微服务 独立的springboot应用</code></pre>
<p>​     将自身配置交给nacos管理</p>
<p><img src="https://gitee.com/hchdream/picturebed/raw/master/img/20210703163915.png" alt="naocs"></p>
<p>​    自身项目中引入 nacos config client依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--nacos config client--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-config<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>​    配置配置文件，修改配置文件名为 bootstrap.properties</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 声明config server地址</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.server-addr</span>=<span class="string">122.207.128.130:8848</span></span><br><span class="line"><span class="comment"># 声明从哪个组获取配置</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.group</span>=<span class="string">DEFAULT_GROUP</span></span><br><span class="line"><span class="comment"># 声明从组中拉取哪个名字的配置</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.name</span>=<span class="string">configclient-prod</span></span><br><span class="line"><span class="comment"># 拉取这个配置哪个后缀的配置文件</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.file-extension</span>=<span class="string">properties</span></span><br></pre></td></tr></table></figure>

<h2 id="统一配置中心nacos"><a href="#统一配置中心nacos" class="headerlink" title="统一配置中心nacos"></a>统一配置中心nacos</h2><ul>
<li><p>dataId细节： 代表完整的配置文件名称        对应bootstrap配置-&gt;spring.cloud.nacos.config.name</p>
<p>​                        完整配置文件名称  = prefix（前缀）+ env（开发环境） + file-extension（文件类型后缀）</p>
<p>​                        dataId = spring.cloud.nacos.config.name + spring.cloud.nacos.config.file-extension</p>
<p>​                        dataId = ${prefix} - ${spring.profile.active}.${file-extension}</p>
</li>
<li><p>微服务拉取配置</p>
<p>a.第一种获取配置的方式</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 声明从组中拉取哪个名字的配置</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.name</span>=<span class="string">configclient-prod</span></span><br><span class="line"><span class="comment"># 拉取这个配置哪个后缀的配置文件</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.file-extension</span>=<span class="string">properties</span></span><br></pre></td></tr></table></figure>

<p>b.第二种获取配置文件的方式</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 第二种获取配置的方式</span></span><br><span class="line"><span class="comment"># dataId = prefix-env.file-extension</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.prefix</span>=<span class="string">configclient</span></span><br><span class="line"><span class="meta">spring.profiles.active</span>=<span class="string">prod</span></span><br><span class="line"><span class="meta">spring.cloud.nacos.config.file-extension</span>=<span class="string">properties</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>统一配置中心 nacos的三个概念</p>
<p>命名空间 namespace    默认nacos安装启动完成后，会有一个默认的命名空间 public</p>
<p>​        作用：站在项目角度隔离每一个项目配置文件</p>
<p>组 group        默认nacos在管理配置文件时，不显示执行group名称时，默认的组名称为DEFAULT_GROUP</p>
<p>​        作用：站在项目中每个服务角度，隔离同一个项目的不同服务模块的配置</p>
<p>文件名 dataId    获取配置文件的唯一标识</p>
<p>​        作用：站在每个项目子模块角度，唯一标识每一个模块的配置文件</p>
</li>
</ul>
<h2 id="nacos-持久化配置"><a href="#nacos-持久化配置" class="headerlink" title="nacos 持久化配置"></a>nacos 持久化配置</h2><p>1.nacos持久化：管理的配置信息持久化</p>
<p>注意：默认nacos存在配置信息持久化，默认的持久化方式为内嵌数据库debrey</p>
<p>确定：无法友好的操作持久化数据</p>
<p>官方建议：在生产环境下推荐将配置持久化到<strong>mysql</strong>数据库，注意：目前nacos到目前为止只支持mysql数据库</p>
<p>2.将nacos持久化到mysql中</p>
<p>​    1.安装数据库，版本要求：5.6.5+</p>
<p>​    2.初始化mysql数据库，创建nacos数据库</p>
<p>​    3.数据库初始化文件：nacos-mysql.sql</p>
<p>​    4.修改conf/application.properties文件，增加支持mysql数据源配置（目前只支持mysql），添加mysql数据源的url、用户名和密码。</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">spring.datasource.platform</span>=<span class="string">mysql</span></span><br><span class="line"><span class="meta">db.num</span>=<span class="string">1</span></span><br><span class="line"><span class="meta">db.url.0</span>=<span class="string">jdbc:mysql://11.162.196.16:3306/nacos_devtest?characterEncoding=utf8&amp;connectTimeout=1000&amp;socketTimeout=3000&amp;autoReconnect=true</span></span><br><span class="line"><span class="meta">db.user</span>=<span class="string">nacos_devtest</span></span><br><span class="line"><span class="meta">db.password</span>=<span class="string">youdontknow</span></span><br></pre></td></tr></table></figure>

<h2 id="nacos-集群搭建"><a href="#nacos-集群搭建" class="headerlink" title="nacos 集群搭建"></a>nacos 集群搭建</h2><p><img src="https://nacos.io/img/deployDnsVipMode.jpg" alt="nacos集群架构图"></p>
<h3 id="1-预备环境准备"><a href="#1-预备环境准备" class="headerlink" title="1. 预备环境准备"></a>1. 预备环境准备</h3><p>请确保是在环境中安装使用:</p>
<ol>
<li>64 bit OS Linux/Unix/Mac，推荐使用Linux系统。</li>
<li>64 bit JDK 1.8+；<a target="_blank" rel="noopener" href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">下载</a>.<a target="_blank" rel="noopener" href="https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/">配置</a>。</li>
<li>Maven 3.2.x+；<a target="_blank" rel="noopener" href="https://maven.apache.org/download.cgi">下载</a>.<a target="_blank" rel="noopener" href="https://maven.apache.org/settings.html">配置</a>。</li>
<li>3个或3个以上Nacos节点才能构成集群。 <ol>
<li>nacos01 122.207.128.130:8845</li>
<li>nacos02 122.207.128.130:8846</li>
<li>nacos03 122.207.128.130:8847</li>
<li>mysql服务 122.207.128.130:3306</li>
<li>nginx 122.207.128.130:8999</li>
</ol>
</li>
</ol>
<h3 id="2-搭建nacos集群注意"><a href="#2-搭建nacos集群注意" class="headerlink" title="2.搭建nacos集群注意"></a>2.搭建nacos集群注意</h3><p>​    1.数据持久化必须配置为mysql持久化</p>
<p>​    2.要求在一个机器启动时，当前虚拟机内存不能少于3G</p>
<h3 id="3-搭建nacos集群"><a href="#3-搭建nacos集群" class="headerlink" title="3.搭建nacos集群"></a>3.搭建nacos集群</h3><p>​    1.准备3个nacos节点，并集成mysql持久化</p>
<p>​    2.重新初始化mysql的数据</p>
<p>​    3.配置nacos01 02 03 分别启动 在nacos的解压目录nacos/的conf目录下，有配置文件cluster.conf，请每行配置成ip:port。（请配置3个或3个以上节点）</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">root@hch-virtual-machine:/home# mv nacos01/conf/cluster.conf.example nacos01/conf/cluster.conf</span><br><span class="line">root@hch-virtual-machine:/home# mv nacos02/conf/cluster.conf.example nacos02/conf/cluster.conf</span><br><span class="line">root@hch-virtual-machine:/home# mv nacos03/conf/cluster.conf.example nacos03/conf/cluster.conf</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ip:port</span></span><br><span class="line">122.207.128.130:8845</span><br><span class="line">122.207.128.130:8846</span><br><span class="line">122.207.128.130:8847</span><br></pre></td></tr></table></figure>

<p>​    4.修改nacos的端口 </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">root@hch-virtual-machine:/home<span class="comment"># vim nacos01/conf/application.properties 8845</span></span><br><span class="line">root@hch-virtual-machine:/home<span class="comment"># vim nacos02/conf/application.properties 8846</span></span><br><span class="line">root@hch-virtual-machine:/home<span class="comment"># vim nacos03/conf/application.properties 8847</span></span><br></pre></td></tr></table></figure>

<p>​    5.启动nacos</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">root@hch-virtual-machine:/home<span class="comment"># ./nacos01/bin/startup.sh</span></span><br><span class="line">root@hch-virtual-machine:/home<span class="comment"># ./nacos02/bin/startup.sh</span></span><br><span class="line">root@hch-virtual-machine:/home<span class="comment"># ./nacos03/bin/startup.sh</span></span><br></pre></td></tr></table></figure>

<p>​    6.使用Nginx实现nacos集群的高可用</p>
<p>​        uabntu系统下的</p>
<p>​        <a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_41621706/article/details/117173069">https://blog.csdn.net/weixin_41621706/article/details/117173069</a></p>
<p>​        1.先安装nginx</p>
<p>​        2.nginx目录 /etc/nginx</p>
<p>​        3.启动nginx  </p>
<p>​            ./nginx</p>
<p>​            查看nginx是否启动    ps aux|grep nginx</p>
<p>​            关闭nginx服务</p>
<p>​        3.修改nigix配置文件</p>
<p><img src="https://gitee.com/hchdream/picturebed/raw/master/img/20210703162902.png" alt="修改nigix配置"></p>
<p>​        4.加载配置启动</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">upstream nacos-server&#123;</span><br><span class="line">        server 122.207.128.130:8845;</span><br><span class="line">        server 122.207.128.130:8846;</span><br><span class="line">        server 122.207.128.130:8847;</span><br><span class="line">&#125;</span><br><span class="line">server &#123;</span><br><span class="line">        listen 80;</span><br><span class="line">        server_name localhost;</span><br><span class="line">        location / &#123;</span><br><span class="line">                proxy_pass http://nacos-server;</span><br><span class="line">        &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>​        5.注意</p>
<p>​        uabntu安装的新版本的nginx后，需要将/etc/nginx/nginxw.conf文件中的两行配置注释掉</p>
<p><img src="https://gitee.com/hchdream/picturebed/raw/master/img/20210703162931.png" alt="新版本nigix配置问题"></p>
<p>​        6.配置好nginx后，配置nacos服务注册中心的地址，直接输入nginx代理的地址即可，nginx自动完成负载均衡</p>
<h1 id="Sentinel"><a href="#Sentinel" class="headerlink" title="Sentinel"></a>Sentinel</h1><h2 id="1-sentinel哨兵"><a href="#1-sentinel哨兵" class="headerlink" title="1.sentinel哨兵"></a>1.sentinel哨兵</h2><p>alibaba开源用来对微服务系统进行保护，替换hystrix</p>
<p>​    hystrix 解决服务雪崩、服务熔断</p>
<p>​    sentinel组件 用来解决服务雪崩  -&gt; 服务熔断 服务降级</p>
<p>spring官网介绍：随着微服务的普及，服务调用的稳定性变得越来越重要。 Sentinel以“流量”为切入点，在流量控制、断路、负载保护等多个领域开展工作，保障服务可靠性。</p>
<h2 id="2-sentinel历史"><a href="#2-sentinel历史" class="headerlink" title="2.sentinel历史"></a>2.sentinel历史</h2><ul>
<li>2012年，sentinel诞生，主要功能为入口流量控制</li>
<li>2013-2017年，sentinel在阿里内部迅速发展，成为基础技术模块，覆盖了所有的核心场景。sentinel也因此积累了大量的生产实践的考验。</li>
<li>2019，sentinel朝着多语言扩展的方向不断发展，推出C++版本，同时针对Service Mesh场景也推出了Envoy集群流量控制支持，以解决Service Mesh架构下的多开发语言限流问题</li>
<li>2020，推出sentinel go版本，继续朝着云原生方向演进</li>
</ul>
<h2 id="3-sentinel概念"><a href="#3-sentinel概念" class="headerlink" title="3.sentinel概念"></a>3.sentinel概念</h2><ul>
<li><p>资源 resource：Java中的一切皆资源    资源：是一个微服务访问路径 rest接口</p>
</li>
<li><p>规则 rule： 流控规则、熔断规则、负载规则</p>
</li>
</ul>
<h2 id="4-sentinel使用"><a href="#4-sentinel使用" class="headerlink" title="4.sentinel使用"></a>4.sentinel使用</h2><p>​    流控、熔断、降级 hystrix</p>
<p>​    sentinel dashboard 哨兵仪表盘组件 功能强大 hystrix dashboard</p>
<p>​    sentinel dashboard下载    dashboard1.7.2 默认为8080</p>
<p>​    java -jar sentinel-dashboard-1.7.2.jar -Dserver.port=xxxx</p>
<p>​    访问dashboard <a target="_blank" rel="noopener" href="http://122.207.128.130:8080/#/login">http://122.207.128.130:8080/#/login</a>    用户名/密码    sentinel/sentinel</p>
<h2 id="5-sentinel-组件保护微服务"><a href="#5-sentinel-组件保护微服务" class="headerlink" title="5.sentinel 组件保护微服务"></a>5.sentinel 组件保护微服务</h2><p>1.开发微服务 springboot应用</p>
<p>2.添加rest接口作为sentinel的资源</p>
<p>3.导入sentinel client依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-sentinel<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>4.配置</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 开启sentinel保护</span></span><br><span class="line"><span class="meta">spring.cloud.sentinel.enabled</span>=<span class="string">true</span></span><br><span class="line"><span class="comment"># 开启sentinel dashboard地址</span></span><br><span class="line"><span class="meta">spring.cloud.sentinel.transport.dashboard</span>=<span class="string">122.207.128.130:8080</span></span><br><span class="line"><span class="comment"># 指定sentinel和sentinel dashboard组件通信地址</span></span><br><span class="line"><span class="meta">spring.cloud.sentinel.transport.port</span>=<span class="string">8719</span></span><br></pre></td></tr></table></figure>

<p>5.启动微服务</p>
<p>6.查看dashboard</p>
<p>​    dashboard信息必须指定服务进行资源调用后才能进行初始化</p>
<p>关于系统吞吐量的相关概念</p>
<p>1.QPS</p>
<p>​    query per second：称之为系统每秒的请求数    5次 /s</p>
<p>2.RT</p>
<p>​    Rsponse Time：响应时间，每个请求的响应时间    ms</p>
<p>6.sentinel保护微服务的5大规则</p>
<p><a target="_blank" rel="noopener" href="https://github.com/alibaba/Sentinel/wiki">https://github.com/alibaba/Sentinel/wiki</a></p>
<p>​    a.流控规则    flow control</p>
<p>原理是监控应用流量的 QPS 或并发线程数等指标，当达到指定的阈值时对流量进行控制，以避免被瞬时的流量高峰冲垮，从而保障应用的高可用性。</p>
<p>QPS：当每秒请求超过指定阈值后对当前请求进行限流</p>
<p>并发线程数：当服务器中创建线程数超过指定阈值后对当前请求进行限制</p>
<p>​    <code>流控模式：</code></p>
<p>①直接    当配置的资源在运行过程中超过当前规则配置的阈值之后做的处理</p>
<p>②关联    当配置的资源在运行过程中超过当前规则配置的阈值，所关联的资源做什么样的处理</p>
<p>③链路    当配置的资源在运行过程中超过当前规则配置的阈值 链路中的资源做什么处理</p>
<p>​    <code>流控效果：</code><strong>只适用于QPS限流</strong> </p>
<p>①快速失败    直接拒绝请求，并且返回异常</p>
<p>②Warn up    冷启动 预热</p>
<p>③排队等待    始终匀速通过</p>
<p>​    b.降级规则    熔断降级DegradeRule</p>
<p>用来避免微服务中的雪崩现象</p>
<p>原理：当监控到调用链路中某一个服务，出现异常（20个以上异常）自动触发熔断，在触发之后对该服务不可调用</p>
<p>原理是监控应用资源调用请求，达到指定阈值时自动触发熔断降级</p>
<p><code>sentinel提供降级规则</code>    时间窗口-&gt;指定熔断时间</p>
<p>①RT    根据响应时间做熔断</p>
<p>②异常比例    根据请求调用过程中出现异常的百分    </p>
<p>③异常数    指定异常数量来进行熔断</p>
<p><img src="https://gitee.com/hchdream/picturebed/raw/master/img/20210703161251.png" alt="降级策略"></p>
<p>​    d.系统规则</p>
<p>Sentinel 系统自适应限流从整体维度对应用入口流量进行控制，结合应用的 Load、CPU 使用率、总体平均 RT、入口 QPS 和并发线程数等几个维度的监控指标，通过自适应的流控策略，让系统的入口流量和系统的负载达到一个平衡，让系统尽可能跑在最大吞吐量的同时保证系统整体的稳定性。</p>
<p>​    c.热点规则    ParamFlowRule</p>
<p>何为热点？热点即经常访问的数据。很多时候我们希望统计某个热点数据中访问频次最高的 Top K 数据，并对其访问进行限制</p>
<ul>
<li>商品 ID 为参数，统计一段时间内最常购买的商品 ID 并进行限制</li>
<li>用户 ID 为参数，针对一段时间内频繁访问的用户 ID 进行限制</li>
</ul>
<p><code>热点参数限流</code> 访问的资源中携带了指定参数进行限流</p>
<p><code>注意：使用热点限流时，不能使用资源路径，必须使用资源别名</code></p>
<p>a.sentinel提供了资源别名注解 @SentinelResource(value=”别名”)    </p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@SentinelResource(value = &quot;demo&quot;, blockHandler = &quot;demoBlockHandler&quot;, fallback = &quot;demoFallback&quot;,defaultFallback = &quot;fallback&quot;)</span></span><br></pre></td></tr></table></figure>

<p>blockHandler = “demoBlockHandler” 使用sentinel进行不同流控时的默认处理方案，fallback自定义业务出错时的处理方法，defaultFallback    指定业务处理出错时的默认处理方法</p>
<p>​    e.授权规则</p>
<p>很多时候，我们需要根据调用来源来判断该次请求是否允许放行，这时候可以使用 Sentinel 的来源访问控制（黑白名单控制）的功能。来源访问控制根据资源的请求来源（<code>origin</code>）限制资源是否通过，若配置白名单则只有请求来源位于白名单内时才可通过；若配置黑名单则请求来源位于黑名单时不通过，其余的请求通过。</p>
<h1 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h1><p>1.springcloud springcloud&amp;alibaba</p>
<p>springcloud 微服务工具集</p>
<p>springcloud alibaba 微服务一站式解决方案</p>
<p>2.springcloud五大组件</p>
<p>​    a.服务注册中心    eureka consul</p>
<p>​    b.服务间通信组件（ribbon）OpenFeign</p>
<p>​    c.服务熔断    Hystrix    hystrix dashboard</p>
<p>​    d.服务网关组件    zuul 1.x 2.x    Gateway</p>
<p>​    e.服务配置中心    config    + bus 自动配置刷新</p>
<p>3.springcloud alibaba组件</p>
<p>​    a.服务注册中心 服务配置中心    nacos  -&gt;替换 eureka consul    替换config bus</p>
<p>​    b.服务熔断流控降级 sentinel 、sentinel dashboard -&gt; 替换Hystrix    Hystrix dashboard</p>
<p>五大组件</p>
<p>​    服务注册中心    nacos</p>
<p>​    服务间通信    1、restTemplate + ribbon     2、openfeign</p>
<p>​    流控组件    sentinel</p>
<p>​    服务网关    gateway</p>
<p>​    服务配置中心    nacos</p>

        </div>
        <footer class="article-footer">
            



    <a data-url="https://hchdream.gitee.io/hexo/2021/07/03/SpringCloud-Alibaba/" data-id="ckqnkn7ji0021s8rj2exthkxc" class="article-share-link"><i class="fa fa-share"></i>分享到</a>
<script>
    (function ($) {
        $('body').on('click', function() {
            $('.article-share-box.on').removeClass('on');
        }).on('click', '.article-share-link', function(e) {
            e.stopPropagation();

            var $this = $(this),
                url = $this.attr('data-url'),
                encodedUrl = encodeURIComponent(url),
                id = 'article-share-box-' + $this.attr('data-id'),
                offset = $this.offset(),
                box;

            if ($('#' + id).length) {
                box = $('#' + id);

                if (box.hasClass('on')){
                    box.removeClass('on');
                    return;
                }
            } else {
                var html = [
                    '<div id="' + id + '" class="article-share-box">',
                        '<input class="article-share-input" value="' + url + '">',
                        '<div class="article-share-links">',
                            '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
                            '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
                            '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="article-share-pinterest" target="_blank" title="Pinterest"></a>',
                            '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="article-share-google" target="_blank" title="Google+"></a>',
                        '</div>',
                    '</div>'
                ].join('');

              box = $(html);

              $('body').append(box);
            }

            $('.article-share-box.on').hide();

            box.css({
                top: offset.top + 25,
                left: offset.left
            }).addClass('on');

        }).on('click', '.article-share-box', function (e) {
            e.stopPropagation();
        }).on('click', '.article-share-box-input', function () {
            $(this).select();
        }).on('click', '.article-share-box-link', function (e) {
            e.preventDefault();
            e.stopPropagation();

            window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
        });
    })(jQuery);
</script>

        </footer>
    </div>
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "BlogPosting",
        "author": {
            "@type": "Person",
            "name": "XiaoHuang"
        },
        "headline": "SpringCloud&amp;Alibaba",
        "image": "https://hchdream.gitee.io/hexohttps://w.wallhaven.cc/full/j3/wallhaven-j3wqwm.jpg",
        "keywords": "",
        "genre": "springcloud",
        "datePublished": "2021-07-03",
        "dateCreated": "2021-07-03",
        "dateModified": "2021-07-03",
        "url": "https://hchdream.gitee.io/hexo/2021/07/03/SpringCloud-Alibaba/",
        "description": "
SpringCloud Alibaba1.springcloud
​    spring团队开源微服务工具集帮助我们快速构建分布式系统（微服务系统）
2.springcloud alibaba
​    阿里巴巴团队开源微服务工具集解决方案
3.springcloud alibaba
​    官方定义：Spring Cloud Alibaba provides a one-stop solut",
        "wordCount": 2310
    }
</script>

</article>

    <section id="comments">
    
        
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a target="_blank" rel="noopener" href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>


    
    </section>



                        </div>
                    </section>
                    <aside id="sidebar">
    <a class="sidebar-toggle" title="Expand Sidebar"><i class="toggle icon"></i></a>
    <div class="sidebar-top">
        <p>关注我 :</p>
        <ul class="social-links">
            
                
                <li>
                    <a class="social-tooltip" title="github" href="https://github.com/hchdream" target="_blank" rel="noopener">
                        <i class="icon fa fa-github"></i>
                    </a>
                </li>
                
            
                
                <li>
                    <a class="social-tooltip" title="rss" href="/hexo/atom.xml" target="_blank" rel="noopener">
                        <i class="icon fa fa-rss"></i>
                    </a>
                </li>
                
            
        </ul>
    </div>
    
        
<nav id="article-nav">
    
    
        <a href="/hexo/2021/01/29/nginx/" id="article-nav-older" class="article-nav-link-wrap">
        <strong class="article-nav-caption">上一篇</strong>
        <p class="article-nav-title">nginx入门</p>
        <i class="icon fa fa-chevron-left" id="icon-chevron-left"></i>
        </a>
    
</nav>

    
    <div class="widgets-container">
        
            
                

            
                
    <div class="widget-wrap">
        <h3 class="widget-title">最新文章</h3>
        <div class="widget">
            <ul id="recent-post" class="">
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/hexo/2021/07/03/SpringCloud-Alibaba/" class="thumbnail">
    
    
        <span style="background-image:url(https://w.wallhaven.cc/full/j3/wallhaven-j3wqwm.jpg)" alt="SpringCloud&amp;Alibaba" class="thumbnail-image"></span>
    
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/hexo/categories/springcloud/">springcloud</a></p>
                            <p class="item-title"><a href="/hexo/2021/07/03/SpringCloud-Alibaba/" class="title">SpringCloud&amp;Alibaba</a></p>
                            <p class="item-date"><time datetime="2021-07-03T08:26:10.000Z" itemprop="datePublished">2021-07-03</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/hexo/2021/01/29/nginx/" class="thumbnail">
    
    
        <span style="background-image:url(http://hchdream.gitee.io/images/img/portfolio/08-large.jpg)" alt="nginx入门" class="thumbnail-image"></span>
    
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/hexo/categories/nginx/">nginx</a></p>
                            <p class="item-title"><a href="/hexo/2021/01/29/nginx/" class="title">nginx入门</a></p>
                            <p class="item-date"><time datetime="2021-01-28T16:00:00.000Z" itemprop="datePublished">2021-01-29</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/hexo/2020/10/29/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="thumbnail">
    
    
        <span style="background-image:url(http://hchdream.gitee.io/images/img/portfolio/10-large.jpg)" alt="网络编程" class="thumbnail-image"></span>
    
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/hexo/categories/Java/">Java</a></p>
                            <p class="item-title"><a href="/hexo/2020/10/29/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="title">网络编程</a></p>
                            <p class="item-date"><time datetime="2020-10-29T05:39:12.000Z" itemprop="datePublished">2020-10-29</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/hexo/2020/10/27/%E6%B5%8B%E8%AF%95/" class="thumbnail">
    
    
        <span style="background-image:url(https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2926199504,3558053336&fm=26&gp=0.jpg)" alt="测试" class="thumbnail-image"></span>
    
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/hexo/2020/10/27/%E6%B5%8B%E8%AF%95/" class="title">测试</a></p>
                            <p class="item-date"><time datetime="2020-10-27T08:16:08.000Z" itemprop="datePublished">2020-10-27</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/hexo/2020/10/27/hello-world/" class="thumbnail">
    
    
        <span style="background-image:url(https://hchdream.gitee.io/images/img/portfolio/04-large.jpg)" alt="Hello World" class="thumbnail-image"></span>
    
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/hexo/2020/10/27/hello-world/" class="title">Hello World</a></p>
                            <p class="item-date"><time datetime="2020-10-27T05:33:45.370Z" itemprop="datePublished">2020-10-27</time></p>
                        </div>
                    </li>
                
            </ul>
        </div>
    </div>

            
                
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">分类</h3>
        <div class="widget">
            <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/Java/">Java</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/Spring/">Spring</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/nginx/">nginx</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/springcloud/">springcloud</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">数据库</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/%E9%95%9C%E5%83%8F%E5%8A%A0%E9%80%9F/">镜像加速</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/hexo/categories/%E9%A1%B9%E7%9B%AE/">项目</a><span class="category-list-count">1</span></li></ul>
        </div>
    </div>


            
                
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">归档</h3>
        <div class="widget">
            <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2021/07/">七月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2021/01/">一月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2020/10/">十月 2020</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2020/06/">六月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2020/05/">五月 2020</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/hexo/archives/2020/04/">四月 2020</a><span class="archive-list-count">3</span></li></ul>
        </div>
    </div>


            
                
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">标签</h3>
        <div class="widget">
            <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/AOP/" rel="tag">AOP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/Collection/" rel="tag">Collection</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/DI/" rel="tag">DI</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/HashMap/" rel="tag">HashMap</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/HashTabel/" rel="tag">HashTabel</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/IOC/" rel="tag">IOC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/List/" rel="tag">List</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/Map/" rel="tag">Map</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/Set/" rel="tag">Set</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/TreeMap/" rel="tag">TreeMap</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/idea/" rel="tag">idea</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/jdbc/" rel="tag">jdbc</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/jpa/" rel="tag">jpa</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/mybatis/" rel="tag">mybatis</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/mysql/" rel="tag">mysql</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/npm/" rel="tag">npm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/orm/" rel="tag">orm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/properties/" rel="tag">properties</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/thymeleaf/" rel="tag">thymeleaf</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/xml/" rel="tag">xml</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/yarn/" rel="tag">yarn</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/%E4%BB%A3%E7%90%86%E6%A8%A1%E5%BC%8F/" rel="tag">代理模式</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/hexo/tags/%E6%B3%9B%E5%9E%8B/" rel="tag">泛型</a><span class="tag-list-count">1</span></li></ul>
        </div>
    </div>


            
                
    <div class="widget-wrap widget-float">
        <h3 class="widget-title">标签云</h3>
        <div class="widget tagcloud">
            <a href="/hexo/tags/AOP/" style="font-size: 10px;">AOP</a> <a href="/hexo/tags/Collection/" style="font-size: 10px;">Collection</a> <a href="/hexo/tags/DI/" style="font-size: 10px;">DI</a> <a href="/hexo/tags/HashMap/" style="font-size: 10px;">HashMap</a> <a href="/hexo/tags/HashTabel/" style="font-size: 10px;">HashTabel</a> <a href="/hexo/tags/IOC/" style="font-size: 10px;">IOC</a> <a href="/hexo/tags/List/" style="font-size: 10px;">List</a> <a href="/hexo/tags/Map/" style="font-size: 10px;">Map</a> <a href="/hexo/tags/Set/" style="font-size: 10px;">Set</a> <a href="/hexo/tags/TreeMap/" style="font-size: 10px;">TreeMap</a> <a href="/hexo/tags/idea/" style="font-size: 20px;">idea</a> <a href="/hexo/tags/jdbc/" style="font-size: 20px;">jdbc</a> <a href="/hexo/tags/jpa/" style="font-size: 10px;">jpa</a> <a href="/hexo/tags/mybatis/" style="font-size: 20px;">mybatis</a> <a href="/hexo/tags/mysql/" style="font-size: 10px;">mysql</a> <a href="/hexo/tags/npm/" style="font-size: 10px;">npm</a> <a href="/hexo/tags/orm/" style="font-size: 10px;">orm</a> <a href="/hexo/tags/properties/" style="font-size: 10px;">properties</a> <a href="/hexo/tags/thymeleaf/" style="font-size: 10px;">thymeleaf</a> <a href="/hexo/tags/xml/" style="font-size: 15px;">xml</a> <a href="/hexo/tags/yarn/" style="font-size: 10px;">yarn</a> <a href="/hexo/tags/%E4%BB%A3%E7%90%86%E6%A8%A1%E5%BC%8F/" style="font-size: 10px;">代理模式</a> <a href="/hexo/tags/%E6%B3%9B%E5%9E%8B/" style="font-size: 10px;">泛型</a>
        </div>
    </div>


            
                
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">链接</h3>
        <div class="widget">
            <ul>
                
                    <li>
                        <a target="_blank" rel="noopener" href="http://hexo.io">Hexo</a>
                    </li>
                
                    <li>
                        <a target="_blank" rel="noopener" href="https://github.com">Github</a>
                    </li>
                
                    <li>
                        <a target="_blank" rel="noopener" href="https://baidu.com">Baidu</a>
                    </li>
                
            </ul>
        </div>
    </div>


            
        
    </div>
</aside>

                </div>
            </div>
        </div>
        <footer id="footer">
    <div class="container">
        <div class="container-inner">
            <a id="back-to-top" href="javascript:;"><i class="icon fa fa-angle-up"></i></a>
            <div class="credit">
                <h1 class="logo-wrap">
                    <a href="/hexo/" class="logo"></a>
                </h1>
                <p>&copy; 2021 XiaoHuang</p>
                
                <p>Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>.</p>
                
            </div>
            <div class="footer-plugins">
              
    


            </div>
        </div>
	</div>
</footer>


    </div>
    
    
    <script>
    var disqus_shortname = 'hexo-theme-hueman';
    
    
    var disqus_url = 'https://hchdream.gitee.io/hexo/2021/07/03/SpringCloud-Alibaba/';
    
    (function() {
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
    </script>





    
        
<script src="/hexo/libs/lightgallery/js/lightgallery.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-thumbnail.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-pager.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-autoplay.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-fullscreen.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-zoom.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-hash.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-share.min.js"></script>

        
<script src="/hexo/libs/lightgallery/js/lg-video.min.js"></script>

    
    
        
<script src="/hexo/libs/justified-gallery/jquery.justifiedGallery.min.js"></script>

    
    

    
    
    



<!-- Custom Scripts -->

<script src="/hexo/js/main.js"></script>


</body>
</html>
